import Vue from 'vue';
import App from './App.vue'
import router from './common/js/router.js'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import locale from 'element-ui/lib/locale/lang/zh-CN';
import './common/css/global.less';
import 'babel-polyfill';

import Es6Promise from 'es6-promise'

Es6Promise.polyfill()

import './common/js/directive.js'

import {tool} from './common/js/tool.js';
import store from './vuex/index.js';

Vue.config.productionTip = false;

Vue.use(ElementUI, {locale});

Vue.prototype.gotoPage = (path) => {
    let hash = window.location.hash.replace("#", "");
    if (path !== hash) {
        router.push({path: path});
    }
};

import * as filter from './common/js/filter.js';

Object.keys(filter).forEach(key => {
    Vue.filter(key, filter[key])
});

import Breadcrumb from './components/breadcrumb.vue';
import UploadImages from './components/upload-images.vue';
import UploadImage from './components/upload-image.vue';
import UploadVideo from './components/upload-video.vue';
import PromotionGoodsDrawer from './components/promotion-goods-drawer.vue';
import PromotionUserDrawer from './components/promotion-user-drawer.vue';
import Editor from './components/editor.vue';
import OrderSetSpecialPrice from './components/order-set-special-price.vue';
import OrderDeliver from './components/order-deliver.vue';
import OrderLocal from './components/order-local.vue';
import OrderHandleReturn from './components/order-handle-return.vue';

Vue.component('v-breadcrumb', Breadcrumb);
Vue.component('v-upload-images', UploadImages);
Vue.component('v-upload-image', UploadImage);
Vue.component('v-upload-video', UploadVideo);
Vue.component('v-editor', Editor);
Vue.component('v-promotion-goods-drawer', PromotionGoodsDrawer);
Vue.component('v-promotion-user-drawer', PromotionUserDrawer);
//订单详情页 设置特殊优惠
Vue.component('v-order-set-special-price', OrderSetSpecialPrice);
//订单详情页 异地发货
Vue.component('v-order-deliver', OrderDeliver);
//订单详情页 同城配送
Vue.component('v-order-local', OrderLocal);
//订单详情页 处理退货
Vue.component('v-order-handle-return', OrderHandleReturn);

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');
